package com.example.mapper;

import com.example.dto.StudentPageDto;
import com.example.dto.VisitRecordWithStuDto;
import com.example.entity.Student;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StudentMapper {
    @Select("select * from student")
    List<Student> getStudent();

    Page<Student> getBySnameWithSnoWithDno(StudentPageDto studentPageDto);
    @Insert("insert into student (sno, sname, ssex, sdept, dno, scheckin) " +
        "VALUE" +
        "(#{sno},#{sname},#{ssex},#{sdept},#{dno},#{scheckin})")
    void insert(Student student);
    @Select("select count(*) from student where sno = #{sno}")
    int getBySno(Student student);
    @Delete("delete from student where sno = #{sno}")
    void deleteBySno(String sno);

    @Select("select * from student where sno = #{sno}")
    Student findBySno(String sno);


//    @Insert("insert into student (sno, sname, ssex, sdept) values " +
//            "(#{sno},#{sname},#{ssex},#{sdept})")
    void add(Student stu);

    void update(Student student);
    @Insert("insert into student(sno, sname, ssex, sdept) values " +
            "(#{sno},#{sname},#{ssex},#{sdept})")
    void add2(VisitRecordWithStuDto visDto);

    void update2(VisitRecordWithStuDto visDto);

//    Page<Student> getBySnameWithSnoWithDno(StudentPageDto studentPageDto);
}
